<?php
	if (!$this->Session->params['admin'])
    	include 'search_bar.php'; 
    // http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html
?>

<div id="table">
	<table cellspacing="0" cellpadding="0">
	  <tr>
	    <th><?php echo $this->Paginator->sort('name', 'Názov výzvy'); ?></th>
	    <th><?php echo $this->Paginator->sort('description', 'Popis výzvy'); ?></th>
	    <th><?php echo $this->Paginator->sort('Agency.name', 'Agentúra'); ?></th>
	  </tr>
	<?php 
	  foreach($calls as $call){
	      echo '<tr>';
	      echo '<td><b>'.$this->Html->link($call['Call']['name'], array('admin' => false, 'controller' => 'calls', 'action' => 'detail', $call['Call']['id'])).'</b></td>';
	      echo '<td>' . $call['Call']['description'] . '</td>';
	      echo '<td title="'.$call['Agency']['fullname'].'">' . $call['Agency']['name'] . '</td>';
	      echo '</tr>';     
	  }
	?>
	</table>
</div>
<div class="paging">
<?php 
$params = $this->Paginator->params();
if ($params['pageCount'] > 1 ) {
// Shows the page numbers
//echo $this->Paginator->numbers();
echo ' ';
// Shows the prev link
echo $this->Paginator->prev('« Predchádzajúca', null, null, array('class' => 'disabled'));
echo ' ';
// prints X of Y, where X is current page and Y is number of pages
echo $this->Paginator->numbers();//echo $this->Paginator->counter();
echo ' ';
// Shows the next link
echo $this->Paginator->next('Nasledujúca »', null, null, array('class' => 'disabled'));
}
?>
</div>
<?php echo $this->element('limit'); ?>                                                                      